namespace go admin_product_material
include "error_code.thrift"
include "common.thrift"

struct Material {
    1: i64 ID(api.body="id")
    2: string Name(api.body="name")
    3: common.MaterialType Type(api.body="type")
    4: string URL(api.body="url")
    5: i64 GroupID(api.body="group_id")

}

struct GetMaterialListRequest {
    1: i64 Page = 1 (api.query="page");
    2: i64 Size = 20 (api.query="size");
    3: optional i64 GroupID  (api.query="group_id");
}

struct GetMaterialListResponse {
    1: error_code.ErrorCode Code (api.body='code')
    2: list<Material> Data (api.body='data')
    3: i64 Total(api.body='total')
}

struct DeleteMaterialRequest {
    1: list<i64> IDs (api.body="ids")
}

struct DeleteMaterialResponse {
    1: error_code.ErrorCode Code (api.body='code')
}

struct UploadMaterial {
    1: string ImagePath(api.body='image_path')
}

struct UploadMaterialRequest {
}

struct UploadMaterialResponse {
    1: error_code.ErrorCode Code (api.body='code')
    2: UploadMaterial Data(api.body='data')
}

struct CreateMaterialRequest {
    1: i64 GroupID (api.body="group_id")
    2: string Name (api.body="name")
    3: string URL (api.body="url")
    4: common.MaterialType Type(api.body='type')
}

struct CreateMaterialResponse {
    1: error_code.ErrorCode Code (api.body='code')
}